<extend name="Public/base" />

<block name="body">
<div class="main-title">
	<h2>消息列表 [{$_total}]</h2>
</div>
<div class="cf">
	<a class="btn" href="{:U('add')}">新 增</a>
	<button class="btn ajax-post confirm" url="{:U('del')}" target-form="ids">删 除</button>
</div>
<div class="data-table table-striped">
	<form>
		<table>
			<thead>
				<tr>
					<th><input class="checkbox check-all" type="checkbox"></th>
					<th>类型</th>
					<th>标题</th>
					<th>收件人</th>
					<th>发送时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="_list">
					<volist name="_list" id="vo">
						<tr>
							<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$vo['id']}"> </td>
							<td>{$vo.type_text}</td>
							<td>{$vo.title}</td>
							<td>{$vo.uid|get_username}</td>
							<td>{$vo.create_time|time_format}</td>
							<td>
								<a title="查看" href="{:U('view?id='.$vo['id'])}">查看</a>
								<a title="删除" href="{:U('del?id='.$vo['id'])}" class="ajax-get confirm">删除</a>
							</td>
						</tr>
					</volist>
				<else />
					<td colspan="6" class="text-center">aOh! 暂时还没有内容!</td>
				</notempty>
			</tbody>
		</table>
	</form>
	<!-- 分页 -->
	<div class="page">{$_page}</div>
</div>
</block>

<block name="script">
<script type="text/javascript">
$(function() {
    //搜索功能
    $("#search").click(function() {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
    //回车搜索
    $(".search-input").keyup(function(e) {
        if (e.keyCode === 13) {
            $("#search").click();
            return false;
        }
    });
    //导航高亮
    highlight_subnav('{:U('Message/index')}');
});
</script>
</block>